import services from '../api/profile';

export default async (to, next, router) => {
  const {
    auth = false
  } = to.meta;

  if (!auth) return false;

  await services.isLogin()
    .then(() => next())
    .catch(() => {
      router.push('/signin');
    });

  return true;
}
